package cn.doit.scala.day03

import cn.doit.scala.day03.beans.User

/**
 * @DATE 2021/12/27/17:05
 * @Author MDK
 * @Version 2021.2.2
 * */
object C13_Sorted02 {
  def main(args: Array[String]): Unit = {
    val  users = List[User](User(1,"lny",18) , User(3,"liuyan",44) , User(2,"tianhao",18),User(4,"荣波",18))
    val res: List[User] = users.sorted
    println(res)

    val list = users.sortBy(_.name)
    list.foreach(println)
  }

}
